<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('员工每月成本列表')" />
    <th:block th:include="include :: select2-css" />
    <th:block th:include="include :: bootstrap-select-css" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>姓名：</label>
                                <select name="userId"  class="form-control m-b" th:with="type=${@customDictService.selectUserList()}">
                                    <option value="">--请选择--</option>
                                    <option th:each="dict : ${type}" th:text="${dict.userName}" th:value="${dict.userId}"></option>
                                </select>
                            </li>
                            <li>
                                <label>成本中心：</label>
                                <select name="params[businessDepartmentId]" th:with="type=${@customDictService.selectDictBusinessUnitWithDepartments()}">
                                    <option value="">请选择</option>
                                    <optgroup th:each="unit: ${type}" th:label="${unit.name}">
                                        <option th:each="department : ${unit.departments}" th:text="${department.name}" th:value="${department.id}"></option>
                                    </optgroup>
                                </select>
                            </li>
                            <li>
                                <label>年份：</label>
                                <input type="text" name="year"/>
                            </li>
                            <li>
                                <label>月份：</label>
                                <input type="text" name="month"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="erp:payroll:add">
                    <i class="fa fa-plus"></i> 添加
                </a>
                <a class="btn btn-info" onclick="$.table.importExcel()" shiro:hasPermission="erp:payroll:import">
                    <i class="fa fa-upload"></i> 导入
                </a>
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="erp:payroll:export">
                    <i class="fa fa-download"></i> 导出
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
     <th:block th:include="include :: select2-js" />
     <th:block th:include="include :: bootstrap-select-js" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('erp:payroll:edit')}]];
        var removeFlag = [[${@permission.hasPermi('erp:payroll:remove')}]];
        var prefix = ctx + "erp/payroll";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                importUrl: prefix + "/import",
                modalName: "员工每月成本",
                sortName: 'id',
                sortOrder: "desc",
                columns: [
                {
                    field: 'id',
                    title: '',
                    visible: false
                },
                {
                    field: 'userName',
                    title: '姓名'
                },
                {
                    field: 'businessDepartmentName',
                    title: '成本中心'
                },
                {
                    field: 'year',
                    title: '年份'
                },
                {
                    field: 'month',
                    title: '月份'
                },
                {
                    field: 'salary',
                    title: '税前工资'
                },
                {
                    field: 'insurance',
                    title: '公司社保'
                },
                {
                    field: 'accumulationFund',
                    title: '公司公积金'
                },
                {
                    field: 'proxyFee',
                    title: '费用-代理'
                },
                {
                    field: 'computerFee',
                    title: '电脑费用'
                },
                {
                    field: 'bonusFee',
                    title: '提成/奖金'
                },
                {
                    field: 'expenseFee',
                    title: '报销'
                },
                {
                    field: 'otherFee',
                    title: '其他费用'
                },
                {
                    field: 'billFee',
                    title: '费用-账期'
                },
                {
                    field: 'totalFee',
                    title: '共计成本'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });
    </script>
     <!-- 导入区域 -->
     <script id="importTpl" type="text/template">
         <form enctype="multipart/form-data" class="mt20 mb10">
             <div class="col-xs-offset-1">
                 <input type="file" id="file" name="file"/>
                 <div class="mt10 pt5">
                     重复数据将会替换已有数据
                 </div>
                 <font color="red" class="pull-left mt10">
                     提示：仅允许导入“xls”或“xlsx”格式文件！
                 </font>
             </div>
         </form>
     </script>
</body>
</html>